package co.yixiang.modules.order.vo;

import co.yixiang.serializer.BigDecimalSerializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @ClassName ComputeVo
 * @Author hupeng <610796224@qq.com>
 * @Date 2019/10/27
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ComputeVo implements Serializable {

    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal couponPrice;

    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal deductionPrice;

    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal payPostage;

    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal payPrice;

    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal totalPrice;

    private Double usedIntegral; //使用了多少积分

    @JsonSerialize(using = BigDecimalSerializer.class)
    private BigDecimal payIntegral;

    public static ComputeVoBuilder builder() {
        return new ComputeVoBuilder();
    }

    public static class ComputeVoBuilder {
        private BigDecimal couponPrice;
        private BigDecimal deductionPrice;
        private BigDecimal payPostage;
        private BigDecimal payPrice;
        private BigDecimal totalPrice;
        private Double usedIntegral;
        private BigDecimal payIntegral;

        ComputeVoBuilder() {
        }

        public ComputeVoBuilder couponPrice(BigDecimal couponPrice) {
            this.couponPrice = couponPrice;
            return this;
        }

        public ComputeVoBuilder deductionPrice(BigDecimal deductionPrice) {
            this.deductionPrice = deductionPrice;
            return this;
        }

        public ComputeVoBuilder payPostage(BigDecimal payPostage) {
            this.payPostage = payPostage;
            return this;
        }

        public ComputeVoBuilder payPrice(BigDecimal payPrice) {
            this.payPrice = payPrice;
            return this;
        }

        public ComputeVoBuilder totalPrice(BigDecimal totalPrice) {
            this.totalPrice = totalPrice;
            return this;
        }

        public ComputeVoBuilder usedIntegral(Double usedIntegral) {
            this.usedIntegral = usedIntegral;
            return this;
        }

        public ComputeVoBuilder payIntegral(BigDecimal payIntegral) {
            this.payIntegral = payIntegral;
            return this;
        }

        public ComputeVo build() {
            return new ComputeVo(couponPrice, deductionPrice, payPostage, payPrice, totalPrice, usedIntegral, payIntegral);
        }

        public String toString() {
            return "ComputeVo.ComputeVoBuilder(couponPrice=" + this.couponPrice + ", deductionPrice=" + this.deductionPrice + ", payPostage=" + this.payPostage + ", payPrice=" + this.payPrice + ", totalPrice=" + this.totalPrice + ", usedIntegral=" + this.usedIntegral + ", payIntegral=" + this.payIntegral + ")";
        }
    }
}
